In recent years, a video compressing technique represented by MPEG (Moving Picture Experts Group) 2 has been progressed and used in various fields. In case of decoding video data encoded by MPEG2, the decoding is performed every macroblock. When the video data which was decoded every macroblock is stored in a frame memory, memory addresses of the video data are sequentially allocated in a screen display order. That is, in case of a picture plane such that a Y macroblock constructed by 16×16 pixels as shown in FIG. 1A consists of 720×480 pixels, the macroblocks are stored in the frame memory in a state where 45 macroblocks are arranged in the lateral direction and 30 macroblocks are arranged in the vertical direction as shown in FIG. 1B.
In case of allocating the memory addresses and storing the video data as mentioned above, such an allocation is a suitable address allocation in case of displaying the video data onto a screen on the basis of the video data stored in the frame memories. For example, in the frame memory shown in FIG. 1A, when one line in the top portion of the screen is displayed, since the data in addresses 0000 to 0719 (the data as much as 720 pixels) can be continuously read out, the occurrence of a page mishit can be minimized. The “pagemis” denotes a time which is necessary to precharge a sense amplifier provided in a memory such as a DRAM (Dynamic Random Access Memory) or the like (therefore, a process such as reading of the data or the like cannot be performed while precharging).
A DRAM is generally used as a frame memory. The DRAM is constructed by rows and columns and one row is constructed by charge accumulating devices comprising 256 (there is also a case of 512 or the like)×8 columns. Among the charge accumulating devices, an 8-bit device has external terminals of 8 pins and a 16-bit device has external terminals of 16 pins. It indicates the number of bits which can be outputted by one clock. In case of the 8-bit device, 8 bits are outputted by one clock. In case of the 16-bit device, 16 bits are outputted by one clock. Data can be continuously extracted in the same row. That is, in the 8-bit device, since data of 256×8 bits has been accumulated in one row, data of 256 clocks (data of 256 bytes) can be continuously read out.
In a video decoder or the like, video data which is stored in a frame memory is transmitted on a macroblock unit basis and a decoding order is also set to a macroblock order. In one Y macroblock, one line is constructed by 16 lines each consisting of 16 pixels (therefore, 16 bytes). Therefore, for example, in case of the first Y macroblock, the addresses are divided (instead of serial addresses) in a manner such that addresses 0000 to 0015 are allocated to the first line, addresses 0720 to 0735 are allocated to the second line, and addresses 1440 to 1455 are allocated to the third line, and the data is stored.
In case of decoding a stream of a digital video signal from a stream of the MPEG system, a process for detecting a sequence header (Sequence Header) is first performed in an analyzing unit in a decoding apparatus. This is because unless the Sequence_Header is detected, a picture size and an aspect ratio cannot be specified.
That is, in the MPEG stream, there is a case where a picture plane of the SDTV (Standard Definition Television) or a picture plane of the HDTV (High Definition Television) is transmitted. For example, in a digital satellite broadcasting, there is a case where a program of a picture plane of the SDTV and a program of a picture plane of the HDTV are multiplexed and broadcasted in one channel. There is also a case where a channel of a program of a picture plane of the SDTV and channel of a program of a picture plane of the HDTV are switched.
In case of decoding the MPEG stream, first, it is necessary to set a picture size and an aspect ratio. In the MPEG system, a sequence layer has been determined as a most significant layer. In one sequence, a picture size and a picture rate are identical. A Sequence_Header is transmitted at the head of each sequence. The picture size, aspect ratio, picture rate, and the like have been described in the Sequence_Header.
Therefore, hitherto, in case of decoding a bit stream of the MPEG system, first, in order to set the picture size and aspect ratio, the Sequence_Header is detected. After the picture size and aspect ratio were set from the Sequence_Header, a decoding is started from the first picture which was intrafield encoded or intraframe encoded.
After the data stored in one row was extracted, the process advances to the next row and an apparatus has to wait for a time of about 6 clocks for precharging until the data stored in the next row is read out. In this way, the precharge necessary to read out the data stored in another row is called “pagemis” as mentioned above. In the foregoing 8-bit device, the pagemis occurs every 256 clocks (each time the data of 256 bytes is extracted). In the foregoing 16-bit device, the pagemis occurs every 128 clocks. It will be understood that, as mentioned above, when an amount of data which can be extracted by one clock increases, the number of times of occurrence (generating period) of the pagemis decreases.
As shown in FIG. 1B, in the case where the video data is stored and the data is sequentially read out one line by one and displayed in a manner such that the data in addresses 0000 to 0719 is read out to thereby display the first horizontal line and the data in addresses 0720 to 1439 is subsequently read out to thereby display the second horizontal line, a pagemis occurs every 256 bytes in the 8-bit device. Since the pagemis causes a loss time, the ability of a memory (DRAM) can be made the most of by setting in such a manner that the pagemis does not occur as possible.
In case of the foregoing video recorder, the video data is stored on a macroblock unit basis and read out on a macroblock unit basis. Since one Y macroblock is constructed by 16 lines as mentioned above, the pagemis occurs each time one line is read out. That is, the pagemis occurs 16 times whenever one Y macroblock is read out. In case of a chroma signal (Cb, Cr), since one macroblock is constructed by 8 lines each consisting of 8 bytes, the pagemis occurs 8 times whenever one Cb (Cr) macroblock is read out.
In case of using the 16-bit device for the frame memory, since the data of 16 bits (2 bytes) can be outputted in response to one clock, the pagemis occurs at a rate of once per 8 clocks in the Y macroblock. In each of the Cb macroblock and the Cr macroblock, the pagemis occurs at a rate of once per 4 clocks. Therefore, 8 clocks (one line of the Y macroblock is constructed by 16 bytes) are necessary to read out one line of the Y macroblock and 8×16 clocks (one Y macroblock is constructed by 16 lines) are necessary to read out one Y macroblock.
On the other hand, assuming that a time of 6 clocks is expended for the pagemis of one time, it will be understood that the loss time that is caused by the pagemis is equal to the time of 6×16 clocks because the pagemis occurs 16 times in case of reading out one Y macroblock. This means that the ratio of the pagemis is fairly larger than the time (8×16 clocks) which is necessary to read out one Y macroblock. In other words, it means that the loss time is large. Also in case of the macroblock of chroma, the ratio of the loss time for the time that is necessary to read out the data is similarly large.
The pagemis also occurs in case of performing the decoding based on the motion compensation. That is, although the video data as much as one macroblock is extracted from an arbitrary position in the frame memory by a motion vector associated for the macroblock to be decoded, since the address is moved by an amount of one line each time one line of the macroblock is read out in a manner similar to the case mentioned above, the pagemis occurs. There is a problem such that if the user wants to make the most of the ability of the DRAM or the like, it is necessary to suppress the loss time such as a pagemis as small as possible.
The invention is made in consideration of such a circumstance and it is an object of the invention to suppress the occurrence of the pagemis by allocating addresses to video data of macroblocks in the ascending order and storing the data.
In case of decoding the MPEG stream, first, the Sequence_Header is detected and the picture size and aspect ratio are set. However, if the MPEG stream is decoded after the Sequence_Header was detected, there is a problem such that it takes time to detect the Sequence_Header and a fairly long waiting time is necessary until the reproduction is started.
That is, the sequence layer of the MPEG system is a stream in which the picture size and picture rate are identical. Although the Sequence Header can be provided at a minimum GOP (Grop Of Picture) period, a period of the Sequence_Header is not determined. Therefore, a maximum length of sequence is equivalent to one video program. Thus, hitherto, for example, when a channel of a satellite broadcasting is switched, there is a case where it takes time to detect the Sequence_Header and a fairly long waiting time is necessary until the reproduction is started.
Another object of the invention is to provide video processing apparatus and method in which when Sequence_Header information of an MPEG stream is not detected, information of the Sequence_Header is predicted and a decoding is started, thereby enabling the MPEG stream to be immediately decoded.